package gui.commands.classDiagramCommands;

import data.DataVector;
import data.classDiagram.InterfaceEntity;
import gui.commands.ICommand;

/**
 * User: Szymon Kudzia
 * Date: 10.05.13
 * Time: 14:52
 */
public class AddNewInterfaceCommand implements ICommand {
	InterfaceEntity entity;
	String name;

	public AddNewInterfaceCommand(String name) {
		this.name = name;
	}

	@Override
	public void execute() {
		entity = new InterfaceEntity();
		entity.setName(name);

		DataVector.getInstance().addNewEntity(entity);
	}

	@Override
	public void undo() {
		DataVector.getInstance().removeEntity(entity);
	}

	@Override
	public void redo() {
		DataVector.getInstance().addEntity(entity);
	}
}
